package com.myflink.day02;

import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @author Shelly An
 * @create 2020/9/16 16:04
 */
public class Transform_Shuffle {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(2);

        DataStreamSource<String> inputDS = env.readTextFile("input/sensor-data.log");

        inputDS.print("input");

        //shuffle 打散数据，重新分。源码：每条数据随机分配
        DataStream<String> resultDS = inputDS.shuffle();

        resultDS.print("shuffle");

        env.execute();
    }



}
